﻿@using CoralNode.MvcClient.Helper
@using Coralcode.Base.Entity
@model CoralNode.Core.Entity.SearchQuerys.User.PermissionSearchQuery

@{
    ViewBag.Title = "Index";
}
@Html.IncludePage("CoralAdmin/user", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_user"></span><span class="t t_c">用户管理&nbsp;&nbsp;/&nbsp;&nbsp;权限管理</span>
        </div>
        <div id="main">
            <div class="">
                <div class="tablelist_style1" data-js="tabellist_style1">
                    <div class="funsearch p_1 pl_2 pr_2 extra_normal">
                        <a class="btn_5 f_r ml_3" href="/m/user/createPermission">添加权限</a>
                        <div class="f_r">
                            <form method="POST" action="/m/user/listPermission">
                                <i class="icon"></i><span class="t_des f_l pt_0-5">权限名称：</span>
                                <label class="search f_l">
                                    @Html.TextBoxFor(m => m.Title, new { @class = "text w_18", @msg = "请输入关键字" })
                                    @Html.AntiForgeryToken()
                                    <input type="submit" value="" class="submit" /></label>
                            </form>
                        </div>
                    </div>
                    <table cellpadding="0" cellspacing="0">
                        <tr class="exclude">
                            <th width="60">选择</th>
                            <th align="left" width="50">ID</th>
                            <th align="left">名称</th>
                            <th>状态</th>
                            <th align="center" width="140">操作</th>
                        </tr>
                        @foreach (var item in @ViewBag.PermissionList.Items)
                        {
                            <tr>
                                <td>
                                    <label class="checkbox_own">
                                        <input type="checkbox" value="@item.Id"/></label></td>
                                <td class="td_left">@item.Id</td>
                                <td class="td_left">
                                    <a href="/m/user/editPermission/@item.Id">@item.Title</a>
                                </td>
                                <td><a href="/m/user/ChangePermissionStatus/@item.Id" class="ico ico_eye_@item.Status js_changestate btn"></a></td>
                                <td>
                                    <div class="fun">
                                        <a href="/m/user/editPermission/@item.Id">编辑</a><a href="/m/user/deletePermission/@item.Id" class="js_delete">删除</a>
                                    </div>
                                </td>
                            </tr>
                            if (item.HasChildren == DomainEnums.Binary.True)
                            {
                                foreach (var c in item.Children)
                                {
                                    <tr>
                                        <td>
                                            <label class="checkbox_own">
                                                <input type="checkbox" value="@c.Id"/></label></td>
                                        <td class="td_left">@c.Id</td>
                                        <td class="td_left">
                                            <span class="ico ico_child ml_1"></span><a href="/m/user/editPermission/@c.Id">@c.Title</a>
                                        </td>
                                        <td><a href="/m/user/ChangePermissionStatus/@c.Id" class="ico ico_eye_@c.Status js_changestate btn"></a></td>
                                        <td>
                                            <div class="fun">
                                                <a href="/m/user/editPermission/@c.Id">编辑</a><a href="/m/user/deletePermission/@c.Id" class="js_delete">删除</a>
                                            </div>
                                        </td>
                                    </tr>
                                }
                            }

                        }
                    </table>
                </div>
            </div>
        </div>
        <div id="pager">
            <div class="info_pg">共@(ViewBag.PermissionList.TotalItems)条</div>
            <div class="list_pg">
                <a href="/m/user/listPermission?@ViewBag.queryString&p=1" class="first">首页</a>
                @if (@ViewBag.PermissionList.HasPreviousPage && @ViewBag.PermissionList.TotalItems > 0)
                {
                    <a href="/m/user/listPermission?&p=@ViewBag.PermissionList.PreviousPageIndex" class="prev">上一页</a>
                }
                else
                {
                    <a class="prev none">上一页</a>
                }
                @foreach (var i in @ViewBag.PermissionList.PageArray)
                {
                    if (@i == @ViewBag.PermissionList.CurrentPageIndex)
                    {
                    <a class="current">@i</a>
                    }
                    else if (@i == 0)
                    {
                    <a class="more">…</a>
                    }
                    else
                    {
                    <a href="/m/user/listPermission?@ViewBag.queryString&p=@i" href="#">@i</a>
                    }
                }
                @if (@ViewBag.PermissionList.HasNextPage && @ViewBag.PermissionList.TotalItems > 0)
                {
                    <a class="next" href="/m/user/listPermission?@ViewBag.queryString&p=@ViewBag.PermissionList.NextPageIndex">下一页</a>
                }
                else
                {
                    <a class="next none">下一页</a>
                }
                <a class="last" href="/m/user/listPermission?@ViewBag.queryString&p=@ViewBag.PermissionList.TotalPages">尾页</a>
                <!-- <span class="msg">跳转</span>
                <input class="text" type="text" value="">
                <span class="msg">页</span>-->
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('.nav_left_style2').find('li').eq(2).addClass('current');
    })
</script>
